package com.moore.utils;

import com.moore.bean.ApartmentForm;

import java.util.ArrayList;
import java.util.List;

public class RoomNumberGenerator {

    public static List<String> generateRoomNumbers(ApartmentForm apartmentForm) {
        List<String> roomNumbers = new ArrayList<>();

        for (int building = apartmentForm.getStartBuilding(); building <= apartmentForm.getEndBuilding(); building++) {
            for (int floor = apartmentForm.getStartFloor(); floor <= apartmentForm.getEndFloor(); floor++) {
                for (int staircase = apartmentForm.getStartStaircase(); staircase <= apartmentForm.getEndStaircase(); staircase++) {
                    for (int unit = 1; unit <= apartmentForm.getUnitsPerStaircase(); unit++) {
                        String roomNumber = String.format("%d#%d%02d", building, floor, (staircase - 1) * apartmentForm.getUnitsPerStaircase() + unit);
                        roomNumbers.add(roomNumber);
                    }
                }
            }
        }
        return roomNumbers;
    }
}